import java.util.Random;

/**
 * Created by dllo on 18/4/2.
 */
public class Test05 {
    public static void main(String[] args) {
        //定义一个10个元素的数组
        //生成10个随机数,放入这个数组中
        //最后在输出这个数组
        Random random = new Random();

        int[] arr = new int[10];
        arr[0] = 0;
        for (int i = 0; i < arr.length; i++) {

            int num = random.nextInt(10);
            arr[i] = num;//arr[i]=random.nextint()

            System.out.println(num);
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);

        }
        int max = 0;//最好设置为数组的下限
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];


            }
        }
        System.out.println(max);
        int min=arr[0];//如果知道范围写范围的最大值
        for (int i = 0; i < arr.length; i++) {
            if (min>arr[i]){
                min=arr[i];
            }
            System.out.println(min);

        }
    }
}
